package com.ihr360.job.core.step;

import com.ihr360.job.core.JobInterruptedException;
import com.ihr360.job.core.entity.StepExecution;

/**
 * Strategy interface for an interruption policy. This policy allows
 * {@link Step} implementations to check if a job has been interrupted.
 *
 * @author Lucas Ward
 *
 */
public interface StepInterruptionPolicy {

    /**
     * Has the job been interrupted? If so then throw a
     * {@link JobInterruptedException}.
     * @param stepExecution the current context of the running step.
     *
     * @throws JobInterruptedException when the job has been interrupted.
     */
    void checkInterrupted(StepExecution stepExecution) throws JobInterruptedException;
}
